<template>
	<div id="trajectory">
		<div id="mygoChart" style="width:100%; height:400px; background-color: #fff;"></div>
	</div>
</template>

<script>
import trajectory from "../../api/js/WorkOpt/OneWork/trajectory";
export default {
	name: "trajectory",
	data() {
		return {
			data: []
		};
	},

	beforeCreate() {},

	created() {
    },
	mounted() {
		this.$Bus.$on("track", () => {
            this.data = this.$store.getters.getTrack;
            console.log("轨迹图",this.data);
			this.drawing();
		});

		// let nodeDataArray = [
		// 	// note that each node data object holds whatever properties it needs;
		// 	// for this app we add the "name" and "source" properties
		// 	{
		// 		key: "1",
		// 		name1: "董事长",
		// 		name2: "秘书1",
		// 		name3: "秘书2",
		// 		img: require("../../../public/img/portrait.jpeg")
		// 	},
		// 	{
		// 		key: "3",
		// 		parent: "1",
		// 		name1: "CEO",
		// 		name2: "秘书1",
		// 		name3: "秘书2",
		// 		linktext: "link",
		// 		img: require("../../../public/img/portrait.jpeg")
		// 	},
		// 	{
		// 		key: "4",
		// 		parent: "3",
		// 		name1: "总经理",
		// 		name2: "秘书1",
		// 		name3: "秘书2",
		// 		linktext: "link",
		// 		// img: require("../assets/img/02.png")
		// 	}
        // ];
        // this.drawing(nodeDataArray);
	},

	methods: {
		drawing() {
            console.log("渲染轨迹图",this.data);
			let nodeDataArray = [];
			this.data.WF_Node.forEach(item => {
				nodeDataArray.push({
					key: item.ID,
					// parent: Number(item.HisToNDs.split("@")[1]),
					parent: item.ID - 1,
                    name1: item.Name,
                    img: require("../../../public/img/portrait.jpeg")
				});
            });
            console.log("渲染轨迹图",nodeDataArray);
			// trajectory(this, nodeDataArray, "mygoChart");
			trajectory(this, nodeDataArray, "mygoChart");
		}
	},

	//监听
	computed: {},

	components: {},

	//监听后执行动作
	watch: {}
};
</script>

<style lang="less" scoped>
</style>